<?php
class K_MVC_Path_Slave extends K_MVC_Path_Abstract {

    public function __construct($request) {
        $request = substr($request, 5);
        $request = trim(substr($request,0 ,strlen($request) - 3));
        $arRequest = explode('/', $request);
        $this->controller = array_shift($arRequest);
        if (!preg_match(ROUTING_FILTER_PATH, $this->controller)) {
            throw new Exception('Not valid contoller: '.$this->controller);
        }

        $this->method = array_shift($arRequest);
        if (!preg_match(ROUTING_FILTER_PATH, $this->method)) {
            throw new Exception('Not valid method: '.$this->method);
        }

        $this->params = (array_values($arRequest));
        foreach ($this->params as $item) {
            if (!preg_match(ROUTING_FILTER_PARAM, $item)) {
                throw new Exception('Not valid params: '.print_r($this->params, true));
            }
        }

        $this->toLowerCamelCase();
    }

}